<!doctype html>
<html>
<head>
	<meta http-equiv="Content-type" content="text/html; charset=utf-8"/>
	<!-- // <script src="http://libs.baidu.com/jquery/1.9.0/jquery.js" type="text/javascript"></script> -->
	<script type="text/javascript" src="jquery-2.1.1.js"></script>
	<title>定时器</title>
</head>
<body>

<ul>
    <li>list item 1</li>
    <li>list item 2</li>
    <li>list item 3</li>
    <li>list item 4</li>
    <li>list item 5</li>
  </ul>
  <p>a paragraph</p>

<script type="text/javascript">

(function() {
  var timeout = setTimeout;
  window.setTimeout = function(fn, time) {
    if (!time) {
      time = fn;
      return $.Deferred(function(dfd) {
        timeout(function() {
          dfd.resolve.call(self, dfd);
        }, time);
      }).promise();
    }
    timeout.apply(window, arguments);
  }
})();

// 新建一个deferred对象
var dtd = $.Deferred(); 


setTimeout(function() {
  dtd.resolve(); // 改变deferred对象的执行状态
}, 5000);


dtd.done(function(){
  alert('成功')
})

</script>
</body>
</html>